package com.example.littleSpider.myapplication.activity;

import android.view.View;
import android.widget.CheckBox;

import com.example.littleSpider.myapplication.R;
import com.example.littleSpider.myapplication.base.BaseActivity;
import com.example.littleSpider.myapplication.myInterfaces.MethodInTitle;
import com.example.littleSpider.myapplication.view.TitleView;
import com.littlespider.mylibrary.util.T;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by EDZ on 2018/1/2.
 */

public class PayDepositActivity extends BaseActivity implements MethodInTitle {
    @BindView(R.id.title_view)
    TitleView title_view;

    @BindView(R.id.cb_commission)
    CheckBox cb_commission;
    @BindView(R.id.cb_wechat)
    CheckBox cb_wechat;
    @BindView(R.id.cb_alipay)
    CheckBox cb_alipay;

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_paydeposit;
    }

    @Override
    protected void initView() {
        title_view.initMyTitle("生成订单", this);
        title_view.hideTitleTextImage();

    }

    @Override
    protected void initData() {

    }
    //选择支付方式
    @OnClick({R.id.layout_commission, R.id.layout_wechat, R.id.layout_alipay, R.id.btn_gopay})
    void selectPay(View view) {
        switch (view.getId()) {
            case R.id.layout_commission:
                cb_commission.setChecked(true);
                cb_wechat.setChecked(false);
                cb_alipay.setChecked(false);
                break;
            case R.id.layout_wechat:
                cb_wechat.setChecked(true);
                cb_commission.setChecked(false);
                cb_alipay.setChecked(false);
                break;
            case R.id.layout_alipay:
                cb_alipay.setChecked(true);
                cb_commission.setChecked(false);
                cb_wechat.setChecked(false);
                break;
            //去支付
            case R.id.btn_gopay:
                if (cb_commission.isChecked()){
                    //佣金支付
                    T.show(this,"佣金支付");
                }else if (cb_wechat.isChecked()){
                    //微信支付
                    T.show(this,"微信支付");
                }else if (cb_alipay.isChecked()){
                    //支付宝支付
                    T.show(this,"支付宝支付");
                }else {
                    T.show(this,"请选择支付方式");
                }
                break;
        }
    }

    @Override
    public void setGoBack() {
        finish();
    }

    @Override
    public void onRightOne() {

    }

    @Override
    public void onRightTwo() {

    }

    @Override
    public void onTitleText() {

    }
}
